package cn.bugstack.domain.activity.service.discount.Impl;

import cn.bugstack.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import cn.bugstack.domain.activity.service.discount.AbstractDiscountCalculateService;
import com.google.common.util.concurrent.AbstractService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;// BigDecimal 是 Java 中的一个类，用于表示任意精度的有符号的十进制数。常用语金融计算

@Slf4j
@Service("N")
public class NCalculateService extends AbstractDiscountCalculateService  {

    @Override
    protected BigDecimal docalculate(BigDecimal originalPrice, GroupBuyActivityDiscountVO.GroupBuyDiscount groupBuyDiscount) {
        log.info("优惠策略折扣计算：{}" , groupBuyDiscount.getDiscountType().getCode());

        // 折扣表达式，直接为优惠后的价格
        String maketExpr = groupBuyDiscount.getMarketExpr();
        return new BigDecimal(maketExpr);
    }
}
